const express = require('express')
const webpack = require('webpack')
const webpackDevMiddleware = require('webpack-dev-middleware')
const config = require('./webpack.config')
const complier = webpack(config)

// 用express启动一个服务器
const app = express()
// 服务器使用中间件 webpackDevMiddleware
// webpackDevMiddleware中间件会帮助我们监听打包内容的变化，然后重新打包
app.use(webpackDevMiddleware(complier, {}))

app.listen('3000', () => {
  console.log('server is success')
})
